<template>
	<view :class="currentTheme">
		<a-nabbar :name="apiType==='driveCar'?'参与店家':'参与玩家'" />
		<view class=" u-padding-left-32 u-padding-right-32">
			<view  v-for="(item,index) in dataList" :key="index" class="u-margin-top-20">
				<item-box :padding="42">
					<view class="u-flex">
            			<item-image :type="'1'" :img="item.avatar"  :size="100" />
						<text class="u-margin-left-20 text-white u-font-30">{{item.nickname}}</text>
					</view>
					<view class="u-flex">
						<view style="width: 100rpx;"></view>
						<view class="u-margin-left-20 text-white u-font-24">
							<!-- <view class="u-margin-top-24" @click="copyWxId(item.wxId)">微信号：{{item.wxId || '暂无'}}</view> -->
							<view class="u-margin-top-24" @click="callPhone(item.phone)">手机号：{{item.phone}}</view>
							<view class="u-margin-top-24">所在城市：{{item.cityPath | cityPathFormat}}</view>
						</view>
					</view>
					<view class="u-margin-top-50">
						<item-btn height="88" @click="singchat(item)" width="100%">私聊TA</item-btn>
					</view>
				</item-box>
			</view>
		</view>
	</view>
</template>

<script>
	import　{getDetail} from '@/api/crud'
	export default {
		data() {
			return {
				dataList:[],
				apiModule:'shopApi',
				customStyle:{
					backgroundColor:'#765CFE',
					borderColor:'none'
				},
				option:{
					name:''
				}
			}
		},
		computed: {
			name() {
				return this.option.name || 'findDriveCarUserSmallDto' 
			},
			apiType() {
				return this.option.type || 'driveCar'
			}
		},
		onLoad(option) {
			this.option = option;
			getDetail({driveCardId:option.id,...option},this.apiType,this.apiModule,this.name).then(res=>{
				this.dataList =  res;
			})
		},
		methods: {
			singchat(item){
				const chatName = item.nickname;
				const id = item.hxUsername;
				this.$u.route({
					url:'/pages/chat/chat',
					params:{
						type:'singleChat',
						name:chatName,
						id
					}
				})
			},
			//拨打电话
			callPhone(phoneNumber){
				if(!phoneNumber) return false;
				uni.makePhoneCall({phoneNumber});
			},
			//微信号
			copyWxId(wxId){
				if(!wxId) return false;
				uni.setClipboardData({
					data: wxId,
					success:()=>{
						this.$u.toast('复制成功')
					}
				});
			},
		},
	}
</script>

<style lang="scss" scoped>
	.addlarp-btn-box{
		padding: 0 283rpx;
	}
	.page-title{
		&::after{
			content: '';
			display: block;
			height: 4rpx;
			width: 320rpx;
			margin: 27rpx auto;
			background-color: $primary;
		}
	}
</style>
